import 'package:flutter/material.dart';

class AocDecoration extends Decoration {
  final Color color;

  const AocDecoration({this.color = Colors.yellowAccent});

  @override
  BoxPainter createBoxPainter([VoidCallback? onChanged]) {
    return _CustomPainter(color);
  }
}

class _CustomPainter extends BoxPainter {
  late Paint _paint;
  Color color;

  _CustomPainter(this.color) {
    _paint = Paint();
    _paint.color = color;
    _paint.strokeWidth = 3;
    _paint.style = PaintingStyle.stroke;
  }

  @override
  void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
    double xAxisPos = offset.dx + configuration.size!.width / 2;
    double yAxisPos = offset.dy + configuration.size!.height / 2 + 22;

    Rect rect =
        Rect.fromCircle(center: Offset(xAxisPos, yAxisPos / 2), radius: 20);
    canvas.drawArc(rect, 0.9, 1.3, false, _paint);
  }
}
